import {ComponentType} from 'react'
import Taro, {Component, Config} from '@tarojs/taro'
import {View, Button, Text, Swiper, SwiperItem, Image} from '@tarojs/components'

import {getRuntime} from "../../utils/common";

import './paySuccess.less'

import icon_08 from '../../assets/img/icon_08.png'


class PaySuccess extends Component {
  state = {
    taxInfo: {}
  }

  componentWillMount() {
    Taro.setNavigationBarTitle({title: '申请成功'})
    this.setState({
      taxInfo: getRuntime().getStorage('taxInfo') || {}
    })
  }

  link(url: string = '/pages/index/index'): void {
    getRuntime().navigateTo(url)
  }

  render() {
    let { taxInfo } = this.state
    return (
      <View className='pay-success'>
         <View className='pay__header'>
            <Image src={icon_08} className='pay-icon' />
            <View className='pay__title'>缴费成功</View>
            <View className='pay__desc color-theme'>
              您可以到订单中下载电子税票或者申请快递纸质税票哦~</View>
         </View>
          <View className='interval' />

          <View className='line-wrap'>
            <View className='line'>
              <View className='line__title'>车辆类型</View>
              <View className='line__cont'>{taxInfo.carType}</View>
            </View>
            <View className='line'>
              <View className='line__title'>车辆规格</View>
              <View className='line__cont'>{taxInfo.carSpec}</View>
            </View>
            <View className='line'>
              <View className='line__title'>车牌号码</View>
              <View className='line__cont'>{taxInfo.carNumber}</View>
            </View>
            <View className='line'>
              <View className='line__title'>缴费金额</View>
              <View className='line__cont color-theme price'><Text className='small color-theme'>￥</Text>{taxInfo.taxPrice}</View>
            </View>
          </View>

          <View className='btn-two-wrap'>
            <View className='btn btn-active' onClick={this.link.bind(this,'/pages/order/orderDetail?orderId='+taxInfo.orderNo)}>查看订单</View>
            <View className='btn' onClick={this.link.bind(this,'/pages/index/index')}>返回首页</View>
          </View>
      </View>
    )
  }
}

export default PaySuccess
